﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HotelWebservice;
using HotelWebservice.HotelWebservice;
using System.Data;


/*
 * 本页面参考http://www.airbnb.com/
*/


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


       //   Load评价最高();
        

    }
    protected void Button1_Click ( object sender , EventArgs e )
    {

        string city = cityTextBox1.Text;
        string  人数 = this.personCountTextBox2.Text;
        DateTime 开始日期 = this.startdateCalendar1.SelectedDate;
        DateTime 结束日期 = this.enddateCalendar.SelectedDate;

        Search(city, 人数, 开始日期, 结束日期);

    }


    public void Search(string city, string 人数, DateTime 开始日期, DateTime 结束日期)
    {
        string paras = string.Format("?{0}={1}&{2}={3}&{4}={5}&{6}={7}",

            QueryStrings.city, city,
          QueryStrings.人数, 人数,
          QueryStrings.StartDate, 开始日期,
         QueryStrings.Enddate, 结束日期
            );


        this.Response.Redirect("detailsearch.aspx" + paras);

        

    }






    HotelWebservice.HotelWebservice.HotelService hsbase;
    HotelWebservice.HotelWebservice.HotelService Hsbase
    {
        get
        {
            if ( hsbase == null)
                hsbase = new HotelWebservice.HotelWebservice.HotelService();
            return hsbase;
        }

    }
    


    public void Load评价最高()
    {
   
        HotelWebservice.HotelWebservice.HotelService hs = new HotelWebservice.HotelWebservice.HotelService();
       DataSetReturn dsr = hs.PingJia(5);

       //dsr = hs.评价最高(5);

       if (dsr.LoginStatus == false)
       {
           //服务器错误，没有返回数据、
           return;
       }

       DataTable table = dsr.DataSet.Tables[0];
       foreach (DataRow r in table.Rows)
       {
           this.Label3.Text = r["Price"].ToString();
       }
      
        this.Label7.Text = "评价最高，返回的数据条数是" + table.Rows.Count.ToString();

        Display评价最高(table);
    }


    public void Display评价最高(System.Data.DataTable d)
    {

    }





    public void Load最受欢迎()
    {


        HotelWebservice.HotelWebservice.HotelService hs = new HotelWebservice.HotelWebservice.HotelService();
        DataSetReturn dsr = hs.评价最高(5);
        if (dsr.LoginStatus == false)
        {
            //服务器错误，没有返回数据、
            return;
        }

        DataTable table = dsr.DataSet.Tables[0];
        foreach (DataRow r in table.Rows)
        {
            this.Label3.Text = r["Price"].ToString();
        }


        this.Label7.Text = "评价最高，返回的数据条数是" + table.Rows.Count.ToString();

        Display最受欢迎(table);

    }


    public void Display最受欢迎(System.Data.DataTable d)
    {


    }




}